<%@include file="package.jsp" %>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
</head>
<body>
<%@include file="includ.jsp" %>
<table border="1px" cellpadding="0" cellspacing="0">
<tr>
<td>学科ID</td>
<td>学科名称</td>
<td>学时</td>
<td>年级号</td>
</tr>
<%
int pagNo=0;
SubjectSerive ss=new SubjectSerive();
 List<Subject>  list=ss.findAll();
 int num=list.size();  /*  获得总条数 */
 int pagSize=15;
 int pages=(num%pagSize==0?(num/pagSize):(num/pagSize)+1);
 String pagNo1=request.getParameter("pagNo");
 
 if(pagNo1==null){
	 pagNo=1;
 }else{
	 pagNo=Integer.parseInt(pagNo1);
 }
 
 List<Subject> list1=ss.paging2(pagNo, pagSize);
 for(Subject sub:list1){
%>
<tr>
<td><%=sub.getId() %></td>
<td><%=sub.getSubjectname() %></td>
<td><%=sub.getClasshour() %></td>
<td><%=sub.getGradeid() %></td>
</tr>
<%} %>
</table>
共<%=num %>条
<%=pagNo %>/<%=pages %>页
<a href="subjectshow.jsp?pagNo=<%=1 %>">首页</a>
<a href="subjectshow.jsp?pagNo=<%=pagNo<=1?1:pagNo-1 %>">上一页</a>
<a href="subjectshow.jsp?pagNo=<%=pagNo>=pages?pages:pagNo+1 %>">下一页</a>
<a href="subjectshow.jsp?pagNo=<%=pages %>">末页</a>
go<input type="number" name="tiaozhuan" id="tiaozhuan">页
</body>
<script src="jquery-3.4.1.js"></script>
<script type="text/javascript">
$(function () {
	$("#tiaozhuan").blur(function () {
	var pagNo= $(this).val();
	<%-- $(this).next().text("<%response.sendRedirect(\"studentshow.jsp?pagNo="+pagNo +"\"); %>") --%>
	 location.replace("subjectshow.jsp?pagNo="+pagNo);
	})
});

</script>

</html>